package cn.com.b2office.struts2.action;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import cn.com.b2office.bean.AccountStat;
import cn.com.b2office.domain.User;
import cn.com.b2office.service.MemberService;

import com.opensymphony.xwork2.ActionSupport;

public class ShowMemberAccountAction extends ActionSupport implements
		SessionAware {

	private static final long serialVersionUID = -2751249894371327733L;

	private MemberService memberService = null;

	private AccountStat accountStat = null;

	private Map session = null;

	public void setMemberService(MemberService memberService) {
		this.memberService = memberService;
	}

	public AccountStat getAccountStat() {
		return accountStat;
	}

	public String execute() throws Exception {
		User user = (User) session.get("user");
		if (user == null)
			return "login";
		accountStat = memberService.getAccountStat(user.getMemberId());
		return SUCCESS;
	}

	public void setSession(Map session) {
		this.session = session;
	}

}
